
import {jwtServerInstance} from "../index";
import qs from	'qs'

//查询所有数据字典项
export const getAll{{capitalizeCamelTableName}} = () => {
    return jwtServerInstance.request({
        url:'/{{flatTableName}}/all',
        method:'post'
    })
}

//参数配置列表查询接口
export const get{{capitalizeCamelTableName}} = (
{% for field in queryParamFields %}
{% if loop.last%}
            {{field.columnName}} ) => {
{% elif not loop.last %}
            {{field.columnName}},
{% endif %}
{% endfor %}
    return jwtServerInstance.request({
        url:'/{{flatTableName}}/query',
        method:'post',
        data:qs.stringify({
{% for field in queryParamFields %}
{% if loop.last%}
            {{field.columnName}}
{% elif not loop.last %}
            {{field.columnName}},
{% endif %}
{% endfor %}
        })
    })
}

//更新{{tableName}}的一条数据记录
export const update{{capitalizeCamelTableName}} = (dialogForm) => {
    return jwtServerInstance.request({
        url:'/{{flatTableName}}/update',
        method:'post',
        data:dialogForm
    })
}

//新增一条{{tableName}}数据记录
export const add{{capitalizeCamelTableName}} = (dialogForm) => {
    return jwtServerInstance.request({
        url:'/{{flatTableName}}/add',
        method:'post',
        data:dialogForm
    })
}

//删除一条{{tableName}}数据记录
export const delete{{capitalizeCamelTableName}} = (deleteId) => {
    return jwtServerInstance.request({
        url:'/{{flatTableName}}/delete',
        method:'post',
        data:qs.stringify({
            id:deleteId
        })
    })
}